#============================================================================
#	PUB 1.0 Make file
#	by Kyung-Taek, Lim
#	
#
#============================================================================

CXX = g++ -g 
CFLAG = -g -D_REENTRANT 
DS = -L. -I.
MYSQLPP = -L/usr/lib/mysql -I/usr/local/include/mysql++/
MYSQL = -I/usr/include/mysql
PTHREAD = -D_REENTRANT
CFLAGS = 
ALLOBJ = UserMGR.o BookMark.o BookMarkList.o Channel.o ChannelMGR.o Client.o ClientMGR.o Date.o DocStructure.o DocTemplate.o ImageMGR.o Item.o ItemMGR.o KeyTemplate.o Optimizer.o PSocket.o RSSDocumentLink.o RSSDocumentLinkMGR.o RSSRefresher.o SearchKeyStructure.o Tag.o TagMGR.o UserInformation.o XML_Generator.o XML_Util.o

all: Server.o $(ALLOBJ)
	$(CXX) -o Server $(PTHREAD) $(MYSQLPP) $(MYSQL) -lmysqlpp -lmysqlclient -lpthread $(ALLOBJ) Server.o $(CFLAGS)

manual:
	$(CXX) -o Server $(PTHREAD) $(MYSQLPP) $(MYSQL) -g XML_Generator.cpp XML_Util.cpp Server.cpp

Server.o: $(ALLOBJ)
	$(CXX) -c $(MYSQLPP) $(MYSQL) $(PTHREAD) Server.cpp $(CFLAGS)

ClientMGR.o: Client.o ClientMGR.h ClientMGR.cpp
	$(CXX) -c $(PTHREAD) ClientMGR.cpp $(CFLAGS)

Client.o: PSocket.o Client.h Client.cpp
	$(CXX) -c Client.cpp $(CFLAGS)

PSocket.o: PSocket.h PSocket.cpp
	$(CXX) -c PSocket.cpp $(CFLAGS)
	
	
XML_Generator.o: Item.o Tag.o XML_Util.o XML_Generator.h XML_Generator.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) XML_Generator.cpp $(CFLAGS)
	
XML_Util.o: XML_Util.h XML_Util.cpp
	$(CXX) -c XML_Util.cpp $(CFLAGS)
	
	
RSSRefresher.o: DocStructure.o DocTemplate.o RSSDocumentLink.o ChannelMGR.o TagMGR.o ItemMGR.o Date.o RSSRefresher.h RSSRefresher.cpp
	$(CXX) -c RSSRefresher.cpp $(CFLAGS)
	
DocTemplate.o: DocStructure.o DocTemplate.h DocTemplate.cpp
	$(CXX) -c DocTemplate.cpp $(CFLAGS)
	
DocStructure.o: ImageMGR.o DocStructure.h DocStructure.cpp 
	$(CXX) -c DocStructure.cpp $(CFLAGS)
	
ImageMGR.o: ImageMGR.h ImageMGR.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) ImageMGR.cpp $(CFLAGS)
	
	
RSSDocumentLinkMGR.o: RSSDocumentLink.o Date.o RSSDocumentLinkMGR.h RSSDocumentLinkMGR.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) RSSDocumentLinkMGR.cpp $(CFLAGS)
	
UserMGR.o: UserInformation.o TagMGR.o UserMGR.h UserMGR.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) UserMGR.cpp $(CFLAGS)
	
ItemMGR.o: ChannelMGR.o TagMGR.o Item.o Date.o ItemMGR.h ItemMGR.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) ItemMGR.cpp $(CFLAGS)
	
ChannelMGR.o: Channel.o Date.o ChannelMGR.h ChannelMGR.cpp
	$(CXX) -c  $(MYSQLPP) $(MYSQL) ChannelMGR.cpp
#	g++ -c -o ChannelMGR.o -L/usr/lib/mysql -I/usr/local/include/mysql++ -I/usr/include/mysql -lmysqlpp ChannelMGR.cpp
	
TagMGR.o: Tag.o TagMGR.h TagMGR.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) TagMGR.cpp

	
	
Optimizer.o: KeyTemplate.o Optimizer.h Optimizer.cpp
	$(CXX) -c Optimizer.cpp $(CFLAGS)
	
KeyTemplate.o: SearchKeyStructure.o KeyTemplate.h KeyTemplate.cpp
	$(CXX) -c KeyTemplate.cpp $(CFLAGS)
	
SearchKeyStructure.o: SearchKeyStructure.h SearchKeyStructure.cpp
	$(CXX) -c SearchKeyStructure.cpp $(CFLAGS)


UserInformation.o: BookMarkList.o UserInformation.h UserInformation.cpp
	$(CXX) -c UserInformation.cpp $(CFLAGS)
	
BookMarkList.o: BookMark.o BookMarkList.h BookMarkList.cpp
	$(CXX) -c $(MYSQLPP) $(MYSQL) BookMarkList.cpp $(CFLAGS)
	
BookMark.o: Tag.o BookMark.h BookMark.cpp
	$(CXX) -c BookMark.cpp $(CFLAG)
	
RSSDocumentLink.o: Date.o RSSDocumentLink.h RSSDocumentLink.cpp
	$(CXX) -c RSSDocumentLink.cpp $(CFLAG)

	
Item.o: Channel.o Tag.o Date.o Item.h Item.cpp
	$(CXX) -c Item.cpp $(CFLAGS)
	
Channel.o: Channel.h Channel.cpp
	$(CXX) -c Channel.cpp $(CFLAGS)

Tag.o: Tag.h Tag.cpp
	$(CXX) -c Tag.cpp $(CFLAGS)
	

Date.o: Date.h Date.cpp
	$(CXX) -c Date.cpp $(CFLAGS)

	
clean:
	rm -rf *.o
	rm -f Server
